M = {}

local config = require("nvim-treesitter.configs")
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()

function M.setup()
  -- 添加 http 文件的 ts
  parser_configs.http = {
    install_info = {
      url = "https://github.com/NTBBloodbath/tree-sitter-http",
      files = { "src/parser.c" },
      branch = "main",
    },
  }

  config.setup {
  	ensure_installed = "maintained",
  	highlight = {enable = true},
  	indent = {enable = true},
    -- 自动括号匹配
    autotag = {
      enable = true,
    },
    -- 彩虹括号
    rainbow = {
      enable = true,
      -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
      extended_mode = true,
      -- Do not enable for files with more than n lines, int
      max_file_lines = nil,
      -- colors = {}, -- table of hex strings
      -- termcolors = {} -- table of colour name strings
    }
  }
end

return M
